<template>
    <div>
        <Menu/>
        <el-form>
 <el-form-item></el-form-item>
    <el-form-item></el-form-item>
  </el-form>
  <span>
  <h2 ><font  color="red" style="position:absolute; left:220px; top:70px;">修改密码</font></h2></span>
  <el-form ref="visitsForm" :model="visitsForm" label-width="80px" class="el-f">
  <el-form-item label="用户名" prop="username"  >
    <el-input v-model="visitsForm.username" ></el-input>
  </el-form-item>
   <el-form-item label="密码" prop="password" >
    <el-input v-model="visitsForm.password" maxlength="11"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="onSubmit('visitsForm')">提交</el-button>
    <el-button @click="resetForm('visitsForm')">取消</el-button>
  </el-form-item>
</el-form>

    </div>
</template>

<script>
import Menu from '../components/Menu'
export default {
name:"MyInformation",
components:{
    Menu,
},
data() {
   
      return {
        visitsForm: {
          username: '',
          password:'',
        },
        
     }
    },
    methods: {
            onSubmit() {
      
          this.$axios.post("http://localhost:5453/user/update", this.visitsForm).then( res => {
              console.log(res)
              if(res.data.code == 200){
                this.$message({
                  message: res.data.msg,
                  type: 'success'
                });
                  this.$refs.visitsForm.resetFields();
              }else{
                this.$message.error(res.data.msg);
              }
          }).catch( res => {
              console.log(res)
          })
          },
          
			resetForm(formName) {
      this.$refs[formName].resetFields();
      
    },
    
}
}
</script>
<style>
.my-label {
    background: #E1F3D8;
  }

  .my-content {
    background: #FDE2E2;
  }
  .el-input {width: 400px;}


  .my-content1 {
    background: #013fa3d1;
  }
      

    
</style>
